package com.dhcc.sdc.base.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.service.impl.BaseServiceImpl;
import com.dhcc.sdc.base.dao.SdcQcCdssLinkMapper;
import com.dhcc.sdc.base.service.ISdcQcCdssLinkService;
import com.dhcc.sdc.base.entity.SdcQcCdssLinkEntity;

/**
 * 质控项目和CDSS诊疗方案关联表表数据服务层接口
 * 
 * @ClassName: SdcQcCdssLinkServiceImpl
 * @Description: TODO
 * @author sunyingjie
 * @date 2022-12-02 13:52:59
 */
@Service("sdcQcCdssLinkService")
public class SdcQcCdssLinkServiceImpl extends BaseServiceImpl<SdcQcCdssLinkMapper, SdcQcCdssLinkEntity> implements ISdcQcCdssLinkService {

	@Override
	public List<SdcQcCdssLinkEntity> page(Page<SdcQcCdssLinkEntity> page, Map<String, Object> map) {
		return this.baseMapper.page(page, map);
	}
	@Override
	public List<SdcQcCdssLinkEntity> list(Map<String, Object> map) {
		return this.baseMapper.list(map);
	}

	@Override
	public SdcQcCdssLinkEntity selectByNodeId(String nodeId) {
		return this.baseMapper.selectByNodeId(nodeId);
	}

	@Override
	public void deleteByQcItemId(Long qcItemId) {
		this.baseMapper.deleteByQcItemId(qcItemId);
	}

	@Override
	public String getLinkCdssByQcItemId(Long qcItemId) {
		String res = "";
		Map<String, Object> map = new HashMap<>();
		map.put("qcItemId", qcItemId);
		List<SdcQcCdssLinkEntity> list = this.list(map);
		for (SdcQcCdssLinkEntity sdcQcCdssLinkEntity : list){
			String nodeId = "";
			/*if (sdcQcCdssLinkEntity.getType() == 1){
				itemId = "eval" + sdcQcCdssLinkEntity.getCdssItemId();
			}else if (sdcQcCdssLinkEntity.getType() == 2){
				itemId = "exam" + sdcQcCdssLinkEntity.getCdssItemId();
			}else if (sdcQcCdssLinkEntity.getType() == 3){
				itemId = "lab" + sdcQcCdssLinkEntity.getCdssItemId();
			}else if (sdcQcCdssLinkEntity.getType() == 4){
				itemId = "treat" + sdcQcCdssLinkEntity.getCdssItemId();
			}else if (sdcQcCdssLinkEntity.getType() == 5){
				itemId = "nursing" + sdcQcCdssLinkEntity.getCdssItemId();
			}*/
			nodeId = sdcQcCdssLinkEntity.getCdssNodeId();

			res = res + "#" + nodeId;
		}
		return res;
	}

}